home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 145 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  36 lines

  1. Path: news.csie.nctu.edu.tw!jkng
  2. From: jkng@csie.nctu.edu.tw (NortonNg)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to make a Complex class
  5. Date: 2 Jan 1996 00:58:21 GMT
  6. Organization: Dep. Computer Sci. & Information Eng., Chiao Tung Univ., Taiwan, R.O.C
  7. Message-ID: <4c9vvd$rjh@news.csie.nctu.edu.tw>
  8. References: <4c8kdm$p0q@news.csie.nctu.edu.tw> <4c984a$99t@atlas.axiom.net>
  9. NNTP-Posting-Host: jkng@ccsun39.csie.nctu.edu.tw
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Dave Nulton (dnult@axiom.net) ┤ú¿∞:
  13. : I've just been working with complex classes myself in C++.  The 
  14. : class is in there.  There is already a library installed in my 
  15. : compiler - use it by including <complex.h>.  It defines a 
  16. : structure you use called complex.  Define a number something like 
  17. : this.
  18. : complex(double r, double i);
  19. : As far as your format (typical mathmatical format) you'll have to 
  20. : format you output and parse you input to make it work properly.
  21. : The advantage to the complex library is that most all of the math 
  22. : functions and stream operators have been overloaded to handle the 
  23. : complex math.  In addition there are several standard functions.  
  24. : The only thing not included is polar operators, but those are easy 
  25. : to construct.
  26. : Hope that helps
  27. : -dnult
  28.  
  29.     Thanks for you help, but I still have a problem can not be overcomed.
  30. That is how to write to function which parse my input to make the complex
  31. class work properly.  For instance, if I input (3+4.5i)*(2-8i)-(5i)
  32. the function must parse it and then do the correct answer.
  33.     I don't know how to make it, hope you can make it. Thanks....
  34.  
  35.  
  36.